<template>
  <div>
    <el-table
      :data="mylist"
      :header-row-style="clslist"
      style="width: 100%; margin-bottom: 20px"
      row-key="id"
      border
      :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
    >
      <el-table-column prop="title" label="名称" sortable width="180">
      </el-table-column>
      <el-table-column prop="icon" label="图标" sortable width="180">
        <template slot-scope="scope">
          <i :class="scope.row.icon"></i>
        </template>
      </el-table-column>
      <el-table-column prop="type" label="类型">
        <template slot-scope="scope">
          <el-button
            plain
            size="mini"
            :type="scope.row.type == 1 ? 'success' : 'primary'"
            >{{ scope.row.type == 1 ? "目录" : "菜单" }}</el-button
          >
        </template>
      </el-table-column>
      <el-table-column prop="url" label="地址"></el-table-column>
      <el-table-column prop="address" label="操作">
        <template slot-scope="scope">
          <el-button size="mini" @click="handleEdit(scope.$index, scope.row)"
            >编辑</el-button
          >
          <el-button
            size="mini"
            type="danger"
            @click="handleDelete(scope.$index, scope.row)"
            >删除</el-button
          >
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  props: ["mylist", "clslist"],
  name: "",
  components: {},
  data() {
    return {};
  },
  created() {},
  mounted() {},
  methods: {
    handleEdit(index, row) {
      this.$emit("edit", { index, row });
    },
    handleDelete(index,row) {
      this.$emit("remove", { index, row });
    },
  },
};
</script>
<style scoped lang="scss"></style>
